<?
require_once("admin/classes/check_customer_session.php");
require_once("admin/dbconnect.php");
require_once('admin/classes/PaginateIt.php'); 
$PaginateIt = new PaginateIt();
$PaginateIt->SetItemsPerPage(10);
$PaginateIt->SetLinksToDisplay(8);
$PaginateIt->SetLinksFormat( '<< Previous', '  ', 'Next >>' );

$PaginateIt->SetQueryString("gender=".$_REQUEST['gender']."&age_min=".$_REQUEST['age_min']."&age_max=".$_REQUEST['age_max']."&country=".$_REQUEST['country']."&city=".$_REQUEST['city']."&marital_status=".$_REQUEST['marital_status']."&feetInch=".$_REQUEST['feetInch']."&weightKg=".$_REQUEST['weightKg']."&degree=".$_REQUEST['degree']."&occupation=".$_REQUEST['occupation']."&mothertongue=".$_REQUEST['mothertongue']);

session_start();
?>
<?
                $gend = $_REQUEST['gender'];
                  $minage =$_REQUEST['age_min'];
                $maxage = $_REQUEST['age_max'];
                  $mari =$_REQUEST['marital_status'];

                $con =$_REQUEST['country'];
                $cit = $_REQUEST['city'];
                  $ht =$_REQUEST['feetInch'];
                $wt = $_REQUEST['weightKg'];
                  $deg =$_REQUEST['degree'];
                $ocu = $_REQUEST['occupation'];
                  $mot =$_REQUEST['mothertongue'];

                $sql = "SELECT customer.customer_id, customer.name,customer.online_status,customer.surname, customer.gender, DATE_FORMAT(customer.online, '%d-%M-%Y') as dton, customer.feetInch, customer.age, occupation.occupation, customer.country, nativeplace.nativeplace, customer.expectation, customer.image_1, customer.degree, customer.mothertongue
FROM (((customer INNER JOIN occupation ON customer.occupation = occupation.occupation_id) INNER JOIN state ON customer.state = state.state_id) INNER JOIN country ON customer.country = country.country_id) INNER JOIN nativeplace ON customer.city = nativeplace.nativeplace_id
WHERE customer.gender = '$gend' and customer.age >= $minage and customer.age <= $maxage and customer.marital_status = '$mari'";

                if($_REQUEST['country']=='All'){

                }
                else {
                $sql .= " and customer.country = $con";
                }
                if($_REQUEST['city']=='All'){
                                }
                                else {

                                $sql .= " and customer.city = $cit";
                                }

                if($_REQUEST['degree']=='All'){

                        }
                        else {
                $sql .= " and customer.degree = $deg";
                }

                if($_REQUEST['occupation']=='All'){

                        }
                        else {
                $sql .= " and customer.occupation = $ocu";
                }
                if($_REQUEST['feetInch']=='All'){

                        }
                        else {
                $sql .= " and customer.feetInch >= $ht";
                }
                if($_REQUEST['weightKg']=='All'){

                        }
                        else {
                $sql .= " and customer.weightKg >= $wt";
                }

//        $sql.= "and customer.status = 'Y'";

                $rs = mysql_query($sql) or die(mysql_error());
                $cnt = mysql_num_rows($rs);
                $sql .= " ORDER BY customer.customer_id DESC";
				$sql .= $PaginateIt->GetSqlLimit();
                $rs = mysql_query($sql) or die(mysql_error());
				$PaginateIt->SetItemCount($cnt);


                ?>

<?php require_once('include/header.php'); ?>


      <div id="middle_container_for_innerpage">
      <div id="innerpage_top_image"><img src="images/images/innerpage_top_corner_820x5.jpg"  height="5" /></div> 
      <div id="middle_inner_container">
     <?php require_once('include/left_menu.php'); ?>

        
        <div id="inner_page_middle_data">
        
          <div id="page_heading">Advanced Search Result </div>
        <div id="below_page_heading_text">
		
		
        <!--                display dynamic data -->
        <?
        if(@mysql_num_rows($rs)>0){
                                ?>
		<p><strong>Total number of Profile <?php echo $b; ?> to <?php echo $pagecount_1+ $b; ?> out of <?php echo $cnt; ?></strong></p>
        		<div id="pagination"><? echo $PaginateIt->GetPageLinks(); ?></div>
        </div>
		<div id="code"><?  while($row=mysql_fetch_array($rs)){ ?></div>
                <?php $profile_permalink = profile_permalink($row['customer_id'],$row['name'],$row['surname']); ?>
        <div id="advanced_search_profile" onmouseover="myBG(this,'#F8FCFD')" onmouseout="myBG(this,'')">
        	<div align="center" id="customer_image"><?if($row['image_1']){?><a href="<?php echo $profile_permalink; ?>"><img src="uploaded/thumb/<?=$row['image_1']?>"  border="0" class="image_border"></a>
                  <?}else{?>
                <a href="<?php echo $profile_permalink; ?>"><? if($row['gender']=="Male"){?><img src="images/images/default_eparinay_groom.jpg" width="90" height="90" border="0" class="image_border" ><?} else{?>
				<img src="images/images/default_eparinay_bride.jpg" width="90" height="90" border="0" class="image_border" ><?}?></a>                <?}?></div>
            <div id="customer_data">
            	<div id="profile_id">
                	<div id="profile_id_text"><a href="<?php echo $profile_permalink; ?>" ><strong>Profile ID: <?php echo $row['customer_id']; ?></strong></a></div>
                    <div id="online_offline_icons">
                    	 <div id="online_offline_icons">

                        <?if($row['online_status']=="online"){?>
                        <div style="float:left">Online:</div>
                        <?php }else{?>
                        <div style="float:left">Offline:</div>
                            <?php } ?>
                    	<div id="small_icon">
                        <?if($row['online_status']=="online"){?>
                        <img src="/images/images/status_online.png" alt="Online" title="Online" width="16" height="16" />
                        <?php }else{?>
                        <img src="/images/images/status_offline.png" alt="Offline" title="Offline" width="16" height="16" />
                            <?php } ?>
                        </div>

                    </div>
                    </div>
                </div>
                <div id="brief_profile"><a href="<?php echo $profile_permalink; ?>"><strong><?php echo $row['name']; ?></strong></a>, <?php echo $row['age']; ?>, <?php echo $row['feetInch']; ?> Inch., <?php echo $row['occupation']; ?>, <?php echo $row['nativeplace']; ?></div>
                <div id="brief_expectations"><?=stripslashes(substr($row['expectation'],0,200)) ?> 
                <a href="<?php echo $profile_permalink; ?>">more...</a></div>
                <div id="last_online"><div id="small_icon"><img src="images/images/icon_user.gif" alt="Last Onlie" width="16" height="16" /></div><span class="green">Last online:</span> <?= $row['dton'] ? "" : $today; ?><?php echo $row['dton']; ?></div>
          <div id="details_link">
                	<div id="icon_and_text_container">
                        <div id="small_icon"><a href="send_message.php?send_to=<?php echo $row['customer_id']; ?>"><img src="images/images/icon_18x18.gif" width="18" height="18" border="0" alt="Send Message" title="Send Message" /></a></div>
                      	<div id="icon_text"><? if($_SESSION['ep_customer_id']) {?>
<a href="send_message.php?send_to=<?php echo $row['customer_id']; ?>">Send Message</a>
 <?} else {?>
<a href="send_message_fail.php">Send Message</a>
 <? } ?></div> |
                    </div>
                    <div id="icon_and_text_container">
                        <div id="small_icon"><a href="<?php echo $profile_permalink; ?>"><img src="images/images/action_go.gif" width="16" height="16" border="0" alt="Send Message" title="Send Message" /></a></div>
                      <div id="icon_text"><a href="<?php echo $profile_permalink; ?>">Details...</a></div>
                  </div>
              </div>
            </div>
        </div>
		<div id="code"><? }

        } else { ?>
        </div>
		<div id="no_results_message">Sorry!! No results found.</div> 
		<div id="code"><? } ?></div>
		<div id="code"><? if ($cnt > 11) {?></div>
        <div id="search_pages"><div id="search_pages_text">&nbsp;</div>
        <div id="search_pages_links"><? echo $PaginateIt->GetPageLinks(); ?></div>
        </div><div id="code"><? } ?></div>

       
       
      </div>
        

       
       
      </div> 
      <div id="corner_container_bottom_for_innerpage"><img src="images/images/innerpage_bottom_corner_820x10.jpg"  height="10" /></div>
    </div> 
      <!-- middle_container ends -->
    
    
        
    
<?php require_once('include/footer.php'); ?>
